using Application.Abstractions.Messaging;
using Domain.Users.Events;
using Microsoft.Extensions.Logging;

namespace Application.Users.Register;

/// <summary>
/// 用户注册事件处理器
/// </summary>
public sealed class UserRegisteredEventHandler(ILogger<UserRegisteredEventHandler> logger)
    : DomainEventHandler<UserRegisteredEvent>
{
    public override async ValueTask Handle(UserRegisteredEvent notification, CancellationToken cancellationToken = default)
    {
        logger.LogInformation(
            "新用户注册: {Email} ({FirstName} {LastName}) 注册时间: {RegisteredAt}",
            notification.Email,
            notification.FirstName,
            notification.LastName,
            notification.RegisteredAt);

        // 这里可以添加其他业务逻辑，比如：
        // - 发送欢迎邮件
        // - 创建默认设置
        // - 记录用户行为
        // - 触发营销活动

        await Task.CompletedTask;
    }
}
